package cn.wolfcode.service;

import cn.wolfcode.domain.OperateIntegralVo;
import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

/**
 * Created by lanxw
 */
@LocalTCC
public interface IUsableIntegralService {
    Boolean pay(OperateIntegralVo vo);

    void refund(OperateIntegralVo vo);

    // try操作
    @TwoPhaseBusinessAction(name = "payTry",commitMethod = "payConfirm",rollbackMethod = "payCancel")
    Boolean payTry(@BusinessActionContextParameter(paramName = "vo") OperateIntegralVo vo, BusinessActionContext context);
    // Confirm操作
    void payConfirm(BusinessActionContext context);
    // Cancel操作
    void payCancel(BusinessActionContext context);

    @TwoPhaseBusinessAction(name = "refundTry",commitMethod = "refundConfirm",rollbackMethod = "refundCancel")
    Boolean refundTry(@BusinessActionContextParameter(paramName = "vo") OperateIntegralVo vo,BusinessActionContext context);
    void refundConfirm(BusinessActionContext context);
    void refundCancel(BusinessActionContext context);
}
